#include"head.h"
#include"funcs.h"

using namespace std;

extern vector<vector<int>> chart;
extern map<char, int> axis;

void analyse(stack<char>& inputs) {
	string buf;
	buf.push_back(T_END);

	while (!inputs.empty()) {
loop:	char current = inputs.top();
		inputs.pop();
		int stat = chart[axis[buf.back()]][axis[current]];
		if (stat == T_LIT || stat == T_EQU) {
			buf.push_back(current);
			goto loop;
		}
		else if (stat == T_EMP) hitWrang();
		else {
			reduction(buf);
			inputs.push(current);
		}
	}
}

